-
-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add --quiet feature #131
add --quiet feature #131
Conversation
Can you add a test? |
yup, doing that and one more question does have to implement the same code in |
Yes |
@@ -64,7 +65,9 @@ function mergeReports(reports) { | |||
function runEslint(paths, opts) { | |||
var config = optionsManager.buildConfig(opts); | |||
var engine = new eslint.CLIEngine(config); | |||
return engine.executeOnFiles(paths, config); | |||
var report = engine.executeOnFiles(paths, config); | |||
report.results = opts.quiet ? eslint.CLIEngine.getErrorResults(report.results) : report.results; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a new processReport(report, opts)
function that contains this common code:
function processReport(report, opts) {
report.results = ....
return report;
}
LGTM |
const filepath = await tempWrite('// TODO: quiet\nconsole.log()\n', 'x.js'); | ||
|
||
try { | ||
await execa('../cli.js', ['--no-local', '--quiet', '--reporter=compact', filepath]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use t.throws
here. It returns the error which you then can check.
https://github.com/avajs/ava#throwsfunctionpromise-error-message
|
||
test('quiet option', async t => { | ||
const filepath = await tempWrite('// TODO: quiet\nconsole.log()\n', 'x.js'); | ||
var err = await t.throws(execa('../cli.js', ['--no-local', '--quiet', '--reporter=compact', filepath])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var
=> const
👍 Awesome :) |
Fix for #125